//
//  CSNavigationTopBannerViewController.swift
//  Cycling
//
//  Created by CSS on 3/30/23.
//

import UIKit

import MapboxNavigation

class CSNavigationTopBannerViewController: BaseViewController {
    
    @IBOutlet private weak var titleLbl: UILabel!
    @IBOutlet private weak var bikeNameLbl: UILabel!
    @IBOutlet private weak var bikeNameWidthConstraint: NSLayoutConstraint!
    
    public var topActionBlock: ((Int) -> Void)?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        refreshBikeNameConstraint()
    }
    
    // MARK: 事件处理方法
    @IBAction private func backButtonAction(_ sender: Any) {
        topActionBlock?(0)
    }
    
}

// MARK: 导航委托
extension CSNavigationTopBannerViewController: NavigationComponent {
    
}

// MARK: 工具类方法
private extension CSNavigationTopBannerViewController {
    func refreshBikeNameConstraint() {
        bikeNameWidthConstraint.constant = bikeNameLbl.intrinsicContentSize.width * 0.6
    }
    
}
